import { createRouter, createWebHistory } from 'vue-router'

import LayoutView from '@/views/LayoutView/index.vue'
import HomeView from '@/views/HomeView/index.vue'
import OrderView from '@/views/OrderView/index.vue'
import MyView from '@/views/MyView/index.vue'
import CartView from '@/views/CartView/index.vue'

import ShopView from '@/views/ShopView/index.vue'

import OrderConfirm from '@/views/OrderView/OrderConfirm.vue'

import AddressCard from '@/components/Address/AddressCard.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name:'LayoutView',
      component: LayoutView,
      redirect:'/home',
      children:[
        {
          path:'/home',
          name:'HomeView',
          component:HomeView
        },
        {
          path:'/cart',
          name:'CartView',
          component:CartView
        },
        {
          path:'/order',
          name:'OrderView',
          component:OrderView
        },
        {
          path:'/my',
          name:'MyView',
          component:MyView
        }
      ]
    },
    // 购物车页
    {
      path: '/shop',
      name: 'ShopView',
      component:ShopView

    },
    // 结算订单页
    {
      path:'/orderConfirm',
      name:'OrderConfirmView',
      component:OrderConfirm
    },
    {
      path:'/address',
      name:'AddressView',
      component:AddressCard
    }
  ]
})

export default router
